package com.tradesolver;

public class MagicEntity {

//  float ebtExclude; //EBT, EXCLUDING UNUSUAL ITEMS
//  float incomeLossEquityInvestment; //Income (Loss) on Equity Investments
//  float currencyExchangeGainsLoss; //Currency Exchange Gains (Loss)
//  float otherNonOperatingIncomeExpense; //Other Non-Operating Income (Expenses)
  
  float currentAssets; //TOTAL CURRENT ASSETS
  float currentLiabilities; //TOTAL CURRENT LIABILITIES
  
  float operatingIncome; //OPERATING INCOME
  float netInterestExpense; //NET INTEREST EXPENSE
  
  float netFixedAssets; //NET PROPERTY PLANT AND EQUIPMENT

//  float lastClosePrice;
//  float numberOfShares;
  
  float cashAndEquivalents; //Cash and Equivalents
  float longTermDebt; //Long-Term Debt

//  float outStandingShares; //Outstanding Shares: PSE
//  float lastSale; //Last Sale: PSE
  float marketCapitalization; //Market Capitalization: PSE
  
  //float ebit; //operatingIncome + netInterestExpense (EBT, EXCLUDING UNUSUAL ITEMS - (Income (Loss) on Equity Investments + Currency Exchange Gains (Loss) + Other Non-Operating Income (Expenses))
  //float netWorkingCapital; //Current Assets - Current Liabilities
  
    
  //float netInterestBearingDebt; //longTermDebt - cashAndEquivalents
  
//  float enterpriseValue; // (lastClosePrice * numberOfShares) + netInterestBearingDebt OR marketCapitalization + netInterestBearingDebt
//  
//  float returnOnCapital; // ebit / (netWorkingCapital + netFixedAssets)
//  float earningsYield; // ebit / enterpriseValue
  
  String ticker;
  String year;
  
  public float getEbit() {
    return operatingIncome + netInterestExpense;
  }
  
  public float getNetWorkingCapital() {
    return currentAssets - currentLiabilities;
  }

  public float getNetInterestBearingDebt() {
    return longTermDebt - cashAndEquivalents;
  }

  public float getEnterpriseValue() {
    return marketCapitalization + getNetInterestBearingDebt();
  }

  public float getROCUsingEbit() {
    return getEbit() / (getNetWorkingCapital() + netFixedAssets);
  }

  public float getROCUsingOperatingIncome() {
    return operatingIncome / (getNetWorkingCapital() + netFixedAssets);
  }
  
  public float getEYUsingEbit() {
    return getEbit() / getEnterpriseValue();
  }

  public float getEYUsingOperatingIncome() {
    return operatingIncome / getEnterpriseValue();
  }

  public float getMagicUsingEbit() {
    return getROCUsingEbit() + getEYUsingEbit();
  }

  public float getMagicUsingOperatingIncome() {
    return getROCUsingOperatingIncome() + getEYUsingOperatingIncome();
  }

  public MagicEntity(String ticker, String year) {
    super();
   this.ticker = ticker;
   this.year = year;
  }

  public float getCurrentAssets() {
    return currentAssets;
  }

  public float getCurrentLiabilities() {
    return currentLiabilities;
  }

  public float getOperatingIncome() {
    return operatingIncome;
  }

  public float getNetInterestExpense() {
    return netInterestExpense;
  }

  public float getNetFixedAssets() {
    return netFixedAssets;
  }

  public float getCashAndEquivalents() {
    return cashAndEquivalents;
  }

  public float getLongTermDebt() {
    return longTermDebt;
  }

  public float getMarketCapitalization() {
    return marketCapitalization;
  }

  public String getTicker() {
    return ticker;
  }

  public String getYear() {
    return year;
  }
  
  
  
//  Earnings Yield= EBIT/ Enterprise Value
//  EBIT= Pre- tax operating earnings a.k.a. operating earnings or income
//  Enterprise Value=  Market Cap+ Preferred Equity+ Net Interest-Bearing Debt- Total Cash and Equivalents
  
  
}
